<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>体检报告查询</title>
        <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport"/>
        <meta content="yes" name="apple-mobile-web-app-capable"/>
        <meta content="black" name="apple-mobile-web-app-status-bar-style"/>
        <meta content="telephone=no" name="format-detection"/>
        <link href="css/style.css" rel="stylesheet" type="text/css"/>
		<script type="text/javascript" src="query.js"></script>
		<script type="text/javascript" src="main.js"></script>
		<style>
			.div_box{
				width: 100%;
				height: 100px;
				 padding: 20px 10px;
				 color: #FFFFFF;
				 border-radius: 10px;
				 margin: 10px 0;
				 background-color: #08AEEA;
				 background-image: linear-gradient(78deg, #08AEEA 0%, #2a68f5 100%);
				text-align: center;
				
			}
			.jgmc{
				font-size: 18px;
				padding-top: 10px;
			}
			.jcsj{
				padding-top: 17px;
				text-align: center;
			}
			.ckbg{
				 padding: 5px; border: 1px solid; font-size: 13px;letter-spacing: 4px;
			}
		</style>
		
		<script>
			$(function(){
				var mIdCard = GetCookie("idcard");
				var OrgCold = GetCookie("OrgCold");
				if ("" == mIdCard || null == mIdCard || undefined == mIdCard) {
					window.location.href = "login.html?resetlogin=1&OrgCold="+OrgCold;
				}
				$(".out").click(function(){
					window.location.href ="login.html?resetlogin=1&OrgCold="+OrgCold;
				});
				$.ajax({
					type: "post",
					url: interfaceUrl+"tj/dataApi/queryHealthTimeByIdCard",
					data: JSON.stringify({
						"idCard": mIdCard
						// "orgncode":OrgCold
					}),
					dataType: "json",
					contentType: "application/json; charset=utf-8", //(可以)
					success: function(res) {
						//alert(JSON.stringify(res).replace(" ", ""));
						var responseData = res.data;
						if(0==res.code){
							if(null!=responseData&&responseData.length>0){
								var htmlData = "";
								$("#name").html(responseData[0].name);
								for (i = 0; i < responseData.length; i++) {
									var ss = responseData[i];
									htmlData = htmlData+'<div class="div_box">'+
													  '<div class="">体检日期：'+formatTime(ss.createTime)+'</div>'+
													  '<div class="jcsj"><span class="ckbg" onclick="opendetail(&apos;'+ss.barcode+'&apos;,&apos;'+ss.comboId+'&apos;,&apos;'+ss.sex+'&apos;,&apos;'+OrgCold+'&apos;)" >查看报告 </span></div>'+
												 ' </div>';
								}
								document.getElementById('homepage').innerHTML = htmlData;
							}
							
						}
						
							
					},
					error: function(XMLHttpRequest, textStatus, errorThrown) {
						console.log(XMLHttpRequest.responseText);
						console.log(XMLHttpRequest.status);
						console.log(errorThrown);
					}
				});
			});
			
			function openhome(){
				window.location.href = "login.html?resetlogin=1&OrgCold="+OrgCold
			}
			
			function GetCookie(name) {
			    var nameValue = "";
			    var key = "";
			    var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
			    if (arr = document.cookie.match(reg)) {
			        nameValue = decodeURI(arr[2]);
			    }
			    if (key != null && key != "") {
			        reg = new RegExp("(^| |&)" + key + "=([^(;|&|=)]*)(&|$)");
			        if (arr = nameValue.match(reg)) {
			            return decodeURI(arr[2]);
			        }
			        else return "";
			    }
			    else {
			        return nameValue;
			    }
			}
			
			function opendetail(barcode, comboId,sex,orgncode) {
				window.location.href = "infoDetailPage.html?barcode=" + barcode + "&comboId="+comboId+"&sex="+sex+"&orgncode="+orgncode;
			}
			
			
			
			
			
			
		</script>
		<style>
			.out{
				position: absolute;
				right: 20px;
				top: -14px;
				padding: 1px 10px;
				color: #fff;
				border: 1px solid #fff;
			}
			
		</style>
    </head>
    <body>
        <section class="aui-flexView">

            <section class="aui-scrollView">
                <div class="aui-head-bg">
                    <div class="aui-flex">
                        <div class="aui-flex-box">
                            <h2>Hi, <span id="name" style="font-size: 32px;color: #e9cccc;padding-right: 10px;"></span>您好！</h2>
                            <h3>关注健康，查看健康体检报告</h3>
							<div class="out">退出</div>
                        </div>
                    </div>
                </div>
                <div class="aui-image-text" id="homepage">
                   
                </div>
                 
                <div style="height:60px;"></div>
            </section>
        </section>

    </body>
</html>
